<template>
	<view class="content">
		<navBar></navBar>
		<view class="first-screen">
			<swiper class="swiper" circular autoplay='true' interval="3000" duration="500">
				<swiper-item v-for="(item,index) in content[0].ads" :key="index" :item-id="index" :data-year="index">
					<view class="swiper-item">
						<!-- :style="{background:item.appPath?('url('+baseUrl + item.appPath +') center no-repeat'):'',backgroundSize:'cover'}" -->
						<image class="pic" :src="baseUrl + item.appPath" mode="aspectFill"></image>
						<view class="screen-text">
							<!-- <view class="s-tit">{{item.title}}</view> -->
							<navigator class="s-btn" :url="item.url">立即探索</navigator>
							<view class="s-icon">
								<image src="../../static/images/icon01.png" mode="widthFix"></image>
							</view>
						</view>
					</view>
				</swiper-item>

			</swiper>

		</view>

		

		<view class="screen-box p0_30">
			<view class="b-tit">
				<text class="ctext">{{content[1].ads[0].title}}</text>

				<rich-text class="etext" :nodes="content[1].ads[0].description"></rich-text>
			</view>
			<rich-text class="b-int" :nodes="content[1].ads[0].content"></rich-text>
			<view class="b-img">
				<image :src="baseUrl+content[1].ads[0].appPath" mode="widthFix"></image>
			</view>

			<navigator class="b-morebtn" :url="content[1].ads[0].url">
				查看详情
			</navigator>

			<view class="b-subtit">
				{{content[2].ads[0].description}}
			</view>


			<rich-text class="b-int" :nodes="content[2].ads[0].content"></rich-text>
			<!-- <tetx class="b-int">
				UMIND经典项链是团队倾心打造的标志性项链<br>
				他象征着UMIND的品牌理念<br>
				以年轻、简约、时尚的黄金珠宝，诠释青春、个性的气息
			</tetx> -->

			<view class="b-img" style="margin-top: 0;">
				<image :src="baseUrl+content[2].ads[0].appPath" mode="widthFix"></image>
			</view>

			<navigator class="r-morebtn" :url="content[2].ads[0].url">
				探索更多
			</navigator>
		</view>


		<view class="screen-box p0_30">
			<view class="b-tit">
				<text class="ctext">{{content[3].ads[0].title}}</text>
				<rich-text class="etext" :nodes="content[3].ads[0].description"></rich-text>
			</view>
			<view class="b-img">
				<image :src="baseUrl+content[3].ads[0].appPath" mode="widthFix"></image>
<!-- 				<navigator class="w-morebtn" :url="content[3].ads[0].url">
					探索更多
				</navigator> -->
			</view>
		</view>

		<view class="screen-box">
			<view class="b-tit">
				<text class="ctext">{{content[4].ads[0].title}}</text>
				<rich-text class="etext" :nodes="content[4].ads[0].description"></rich-text>
			</view>

			<swiper class="swiper" circular autoplay='true' interval="5000" duration="500" previous-margin="95rpx"
				next-margin="95rpx" @change="bindChange">
				<swiper-item v-for="(item,index) in content[4].ads" :key="index" :item-id="index" :data-year="index">
					<navigator :url="item.url" class="swiper-item"
						:style="{background:item?('url('+baseUrl + item.appPath +') center no-repeat'):'',backgroundSize:'cover'}">

					</navigator>

				</swiper-item>



			</swiper>

			<view class="swiper-tit">
				<rich-text class="etext" :nodes="par4_content"></rich-text>
			</view>
<!-- 			<navigator class="r-morebtn" :url="par4_url">
				探索更多
			</navigator> -->
		</view>

		<!-- <navigator class="screen-box" url="../muse/muse">
			<view class="b-tit">
				<text class="ctext">{{content[5].ads[0].title}}</text>
				<rich-text class="etext" :nodes="content[5].ads[0].description"></rich-text>
			</view>

			<swiper class="swiper" circular autoplay='true' interval="5000" duration="500" previous-margin="95rpx"
				next-margin="95rpx">
				<swiper-item v-for="(item,index) in content[5].ads" :key="index" :item-id="index" :data-year="index">
					<view class="swiper-item"
						:style="{background:item?('url('+baseUrl + item.appPath +') center no-repeat'):'',backgroundSize:'cover'}">

					</view>
				</swiper-item>

			</swiper>
		</navigator> -->

		<view class="screen-box">
			<view class="last-tit">
				<view class="ctext">{{content[6].ads[0].title}}</view>
				<view class="etext">
					{{content[6].ads[0].description}}
				</view>
			</view>
			<video :src="baseUrl+content[6].ads[0].videoPath" controls="true"></video>
			<!-- <image :src="baseUrl+content[6].ads[0].appPath" mode="widthFix"></image> -->
		</view>
		<!-- 关注我们 -->
		<!-- <bottom></bottom> -->
	</view>
</template>

<script>
	import navBar from '@/components/navbar/navbar.vue';
	import bottom from '@/components/bottom-follow/bottom-follow.vue';
	import {
		productIndex
	} from '@/api/home.js'
	import {
		type
	} from 'os';
	const app = getApp();

	export default {
		components: {
			navBar,
			bottom,
		},
		data() {
			return {
				baseUrl: this.$baseUrl,
				banners: '',
				content: '',
				openid: '',
				login_token: '',
				name: '',
				logo: '',
				address: '',
				par4_content: '',
				par4_url: '',
				current: 0,
			}
		},
		onLoad(query) {
			console.log(query,1111111)
			console.log(uni.getStorageSync('userInfo'),11111)
			// this.getopenid();
			// console.log('test')
			if(query.scene && query.scene !== '') {
				uni.setStorageSync('promoterCode', query.scene)
			}
		},
		onShow() {
			this.Infor();
		},
		
		onShareAppMessage(e) {
			console.log(e, 1111111)
			let mpShare={
				title:'久福到家',
				path:'/pages/index/index?scene='
			}
			if(uni.getStorageSync('inviteId')){
				let inviteId=uni.getStorageSync('inviteId')
				mpShare.path='/pages/index/index?scene='+inviteId
			}
			return mpShare
		},
		methods: {
			bindChange(e) {
				this.current = e.detail.current
				this.par4_content = this.content[4].ads[this.current].content
				this.par4_url = this.content[4].ads[this.current].url
			},
			Infor() {
				productIndex({
					webClient: 'app'
				}).then(res => {
					this.content = res.data.homePage
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {

		.first-screen {
			position: relative;

			swiper {
				height: 1028rpx;
			}

			.swiper-item {
				width: 100%;
				height: 100%;
				.pic {
					height: 100%;
				}
			}

			.screen-text {
				position: absolute;
				width: 100%;
				text-align: center;
				bottom: 45rpx;

				.s-tit {
					font-size: 48rpx;
					font-weight: 500;
					color: #fff;
					margin-bottom: 50rpx;
					letter-spacing: 10rpx;
				}

				.s-btn {
					width: 300rpx;
					height: 80rpx;
					line-height: 80rpx;
					background-color: #ffffff;
					text-align: center;
					color: #b81c22;
					margin: auto;
					letter-spacing: 4rpx;
					margin-bottom: 45rpx;
				}

				.s-icon {
					width: 30rpx;
					margin: auto;
				}


			}
		}

		.screen-box {
			padding-top: 120rpx;
			text-align: center;

			.b-tit {
				display: flex;
				align-items: center;
				justify-content: center;
				margin-bottom: 50rpx;

				.ctext {
					font-weight: bold;
					letter-spacing: 12rpx;
					color: #b81c22;
					font-size: 50rpx;
					margin-right: 20rpx;
				}

				.etext {
					font-size: 28rpx;
					line-height: 1.3;
					letter-spacing: 5rpx;
					color: #898989;
					text-align: left;
				}
			}

			.b-int {
				font-size: 28rpx;
				
				line-height: 2;
				letter-spacing: 2rpx;
				color: #595757;

			}

			.b-img {
				margin-top: 60rpx;
				position: relative;
			}

			.b-morebtn {
				margin: 60rpx auto;
				width: 200rpx;
				height: 60rpx;
				line-height: 60rpx;
				border: solid 1px #000000;
				color: #000000;
				font-size: 24rpx;
				letter-spacing: 4rpx;
			}

			.b-subtit {
				color: #b81c22;
				font-size: 36rpx;
				font-weight: 600;
				letter-spacing: 9rpx;
				margin-bottom: 60rpx;
			}

			.w-morebtn {
				margin: 60rpx auto;
				width: 200rpx;
				height: 60rpx;
				line-height: 60rpx;
				border: solid 1px #fff;
				color: #fff;
				font-size: 24rpx;
				letter-spacing: 4rpx;
				position: absolute;
				left: 50%;
				bottom: 50rpx;
				transform: translateX(-50%);
			}

			.swiper {
				height: 600rpx;

				swiper-item {
					height: 100%;

					.swiper-item {
						margin: 0 25rpx;
						height: 100%;
					}
				}
			}

			.swiper-tit {
				margin-top: 60rpx;
				font-size: 28rpx;
				line-height: 14rpx;
				letter-spacing: 6rpx;
				color: #595757;
			}

			.r-morebtn {
				margin: auto;
				margin-top: 60rpx;
				width: 200rpx;
				height: 60rpx;
				line-height: 60rpx;
				background-color: #b81c22;
				color: #ffffff;
				font-size: 24rpx;
				letter-spacing: 4rpx;
			}

			.last-tit {
				margin-bottom: 60rpx;

				.ctext {
					font-size: 50rpx;
					font-weight: bold;
					letter-spacing: 12rpx;
					color: #595757;
					margin-bottom: 25rpx;

					text {
						font-size: 50rpx;
						font-weight: bold;
						color: #b81c22;
					}
				}

				.etext {
					font-size: 28rpx;
					letter-spacing: 5rpx;
					color: #898989;
				}
			}

		}
	}
	
	video {
		width: 100%;
	}
</style>
